<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var num = 100
        function double(num) {
            return num * 2
        }
        function pow(num) {
            return num ** 2
        }
        function conposeFn(fns) {
            return function (cs) {
                var result = (fns[0]).apply(this, [cs])
                for (let i = 1; i < fns.length; i++) {
                    const fn = fns[i];
                    result = fn.apply(this, [result])
                }
                return result
            }
        }
        console.log(conposeFn([double, pow])(100));

    </script>
</body>

</html>